package com.zhenbao.service.goods.controller;

import com.zhenbao.common.pojo.Result;
import com.zhenbao.common.pojo.StatusCode;
import com.zhenbao.service.goods.service.SpecService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin//开启跨域请求
@RequestMapping("/spec")
public class SpecController {
    @Autowired
    private SpecService specService;

    @GetMapping("/category/{categoryName}")
    public Result<List<Map>> findSpecListByCategoryName(@PathVariable("categoryName") String categoryName){
        List<Map> specListByCategoryName = specService.findSpecListByCategoryName(categoryName);
        return new Result<>(true, StatusCode.OK,"查询成功",specListByCategoryName);

    }
}
